package com.ns.school.common.config;

import com.ns.school.common.shiro.realm.ShiroUser;
import org.apache.shiro.SecurityUtils;

public class SecurityUtil {

    /**
     * 取出Shiro中的当前用户LoginName.
     */
    public static String icon() {
        return ShiroUser().getIcon();
    }

    public static Integer id() {
        return ShiroUser().getId();
    }

    public static String idStr() {
        return ShiroUser().getId().toString();
    }

    public static String loginName() {
        return ShiroUser().getLoginName();
    }

    public static String nickName() {
        return ShiroUser().getNickName();
    }

    public static ShiroUser ShiroUser() {
        return (ShiroUser) SecurityUtils.getSubject().getPrincipal();
    }
}
